
(function($) {
	//Définition du plugin
	$.fn.abEmploiduTemps = function(options) {	
		
		// définition des paramètres par défaut
		var settings = {
                    title: "",
		    callback: null
		};	
		// mélange des paramètres fournis et par défaut
		var opts = $.extend(settings, options);		
		var load = null;		
		// création d'une liste
              
                 var cpt =  opts.i; var cpt2 = opts.i;
                 var cptID = 0;
                 var x ;
                 var jour = new Array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
                 //var hour = new Array();
                 //hour[0] = new Array("07-08", "08-09", "09-10","10-11","11-12","12-13","13-14","14-15","15-16","16-17","17-18","18-19","19-20","20-21","21-22","22-23","23-24"); 



                        hour = new Array("07-08", "08-09", "09-10","10-11","11-12","12-13","13-14","14-15","15-16","16-17","17-18","18-19","19-20","20-21","21-22","22-23","23-24"); 
       
                   /**for (i=0; i<6; i++){
                         hour[i] = new Array("07-08", "08-09", "09-10","10-11","11-12","12-13","13-14","14-15","15-16","16-17","17-18","18-19","19-20","20-21","21-22","22-23","23-24"); 
                   } */
                 
                     //alert(jour[cpt]);
                 function createList(f){
                     container = $(this);
                   //cpt++;
                    
			// créer la  première zone, affichant l'option sélectionnée
			//var cell = $("<div class='dropdownCell'>" + opts.title + "</div>");
                       // cpt2++ ;
                        var out = '<li  id="passelectable" class="ui-widget-content ">'+ jour[cpt++ -1]+'</li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            out += '<li class="ui-widget-content case " id="'+ (cptID++) +'-'+ (cpt - 2) + '-' + hour[(cptID - 1)] +'"></li>';
                            
                          
                          var outHour = '<li class="ui-widget-content ">Heure</li>';
                          outHour += '<li class="ui-widget-content ">07H-08H</li>';
                           outHour += '<li class="ui-widget-content ">08H-09H</li>';
                           outHour += '<li class="ui-widget-content ">09H-10H</li>';
                           outHour += '<li class="ui-widget-content ">10H-11H</li>';
                           outHour += '<li class="ui-widget-content ">11H-12H</li>';
                           outHour += '<li class="ui-widget-content ">12H-13H</li>';
                           outHour += '<li class="ui-widget-content ">13H-14H</li>';
                           outHour += '<li class="ui-widget-content ">14H-15H</li>';
                           outHour += '<li class="ui-widget-content ">15H-16H</li>';
                           outHour += '<li class="ui-widget-content ">16H-17H</li>';
                           outHour += '<li class="ui-widget-content ">17H-18H</li>';
                           outHour += '<li class="ui-widget-content ">18H-19H</li>';
                           outHour += '<li class="ui-widget-content ">19H-20H</li>';
                           outHour += '<li class="ui-widget-content ">20H-21H</li>';
                           outHour += '<li class="ui-widget-content ">21H-22H</li>';
                           outHour += '<li class="ui-widget-content ">22H-23H</li>';
                           outHour += '<li class="ui-widget-content ">23H-24H</li>';
                          if (container.hasClass('hour')) {
                              container.html(outHour);
                          }
                          else {
                                  container.html(out);
                              }
                          //alert($("#1").text());
                        // $( ".ui-widget-content case.jour" ).selectable({ disabled: true });
                         /*$( ".ui-widget-content case.jour" ).selectable({ cancel: ':input,option' });
                         $( ".ui-widget-content case.jour" ).selectable({
                               selecting: function() { $( ".ui-widget-content.jour" ).selectable({ disabled: true }); }
                             });*/
                 cptID = 0;
                 
                 }
                 
                return this.each(createList);
		return $(this);
                //return this;
	};
})(jQuery);


function addID(array, value){
	var output=[];
        var jour = new Array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
	for(var i in array){
		if (array[i]!=value)
			output[i]=array[i];
	}
	//return output;
}
			